package com.tth.learn.addproperties.java1;

import org.junit.Test;

import java.io.File;

/**
 * @Author tth
 * @Date 2022/12/16 16:50
 */
public class FileTest {
    @Test
    public void test() {
        File file = new File("hello.txt");
        File file1 = new File("D:\\project\\JavaSenior\\hi.txt");

        System.out.println(file.getAbsolutePath());
//        System.out.println(file.getPath());
//        System.out.println(file1.getPath());
//        System.out.println(file.getName());
        System.out.println(file.getParent());
        System.out.println(file1.getParent());
        System.out.println(file.getParentFile());
        System.out.println(file1.getParentFile());
        System.out.println(file.length());
        System.out.println(file.lastModified());
        System.out.println(file.list());
        System.out.println(file.listFiles());
    }

    @Test
    public void test2() {
        File file1 = new File("hello.txt");
        File file2 = new File("D:\\project\\JavaSenior\\hi.txt");

        boolean rename = file1.renameTo(file2);
        System.out.println(rename);
    }
}
